package tool;

public class LongStringTransformer {

	public static long StringToLong(String str) throws NumberFormatException{
		if(str.equals("")){
			return 0;
		}
		long longnum = 0;
		longnum = (long) (Double.parseDouble(str) * 100);
		return longnum;
	}

	public static String LongToString(long num) {
		String tempString = Long.toString(num);
		if (tempString.length() >= 3) {
			String left = tempString.substring(0, tempString.length() - 2);
			String right = tempString.substring(tempString.length() - 2);
			return left + "." + right;
		} else if (tempString.length() == 2) {
			return "0." + tempString;
		} else {
			return "0.0" + tempString;
		}
	}

}
